#include<iostream>
#include<string.h>
#include"Socket.hpp"


int main()
{
    TcpSocket client;
    client.Build_Client_Socket(8888,"127.0.0.1");
    std::string msg = "Hello,world!";
    while(true){
        int n = client.Send(msg.c_str(),msg.size());
        if(n < 0){
            LOG_ERR("send error:%s",strerror(errno));
            continue;
        }
        char buf[1024];
        int m = client.Recv(buf,sizeof(buf)-1);
        if(m < 0){
            LOG_ERR("recv error:%s",strerror(errno));
            continue;
        }
        buf[m] = '\0';
        std::cout << "recv:" << buf << std::endl;
        sleep(1);
    }
    return 0;
}